home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / management / Attribute.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.2 KB  |  48 lines

  1. package javax.management;
  2.  
  3. import java.io.Serializable;
  4.  
  5. public class Attribute implements Serializable {
  6.    private static final long serialVersionUID = 2484220110589082382L;
  7.    private String name;
  8.    private Object value = null;
  9.  
  10.    public Attribute(String var1, Object var2) {
  11.       if (var1 == null) {
  12.          throw new RuntimeOperationsException(new IllegalArgumentException("Attribute name cannot be null "));
  13.       } else {
  14.          this.name = var1;
  15.          this.value = var2;
  16.       }
  17.    }
  18.  
  19.    public String getName() {
  20.       return this.name;
  21.    }
  22.  
  23.    public Object getValue() {
  24.       return this.value;
  25.    }
  26.  
  27.    public boolean equals(Object var1) {
  28.       if (!(var1 instanceof Attribute)) {
  29.          return false;
  30.       } else {
  31.          Attribute var2 = (Attribute)var1;
  32.          if (this.value == null) {
  33.             return var2.getValue() == null ? this.name.equals(var2.getName()) : false;
  34.          } else {
  35.             return this.name.equals(var2.getName()) && this.value.equals(var2.getValue());
  36.          }
  37.       }
  38.    }
  39.  
  40.    public int hashCode() {
  41.       return this.name.hashCode() ^ (this.value == null ? 0 : this.value.hashCode());
  42.    }
  43.  
  44.    public String toString() {
  45.       return this.getName() + " = " + this.getValue();
  46.    }
  47. }
  48.